Integrand size = 26, antiderivative size = 202 \[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=-\frac {i n (d \cot (e+f x))^{3+n}}{4 a^2 d^3 f (i+\cot (e+f x))}-\frac {(d \cot (e+f x))^{3+n}}{4 d^3 f (i a+a \cot (e+f x))^2}+\frac {(1+n)^2 (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )}{4 a^2 d^3 f (3+n)}+\frac {i n (2+n) (d \cot (e+f x))^{4+n} \operatorname {Hypergeometric2F1}\left (1,\frac {4+n}{2},\frac {6+n}{2},-\cot ^2(e+f x)\right )}{4 a^2 d^4 f (4+n)} \]
[Out]
Time = 0.62 (sec) , antiderivative size = 202, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3754, 3640, 3677, 3619, 3557, 371} \[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=\frac {i n (n+2) (d \cot (e+f x))^{n+4} \operatorname {Hypergeometric2F1}\left (1,\frac {n+4}{2},\frac {n+6}{2},-\cot ^2(e+f x)\right )}{4 a^2 d^4 f (n+4)}+\frac {(n+1)^2 (d \cot (e+f x))^{n+3} \operatorname {Hypergeometric2F1}\left (1,\frac {n+3}{2},\frac {n+5}{2},-\cot ^2(e+f x)\right )}{4 a^2 d^3 f (n+3)}-\frac {i n (d \cot (e+f x))^{n+3}}{4 a^2 d^3 f (\cot (e+f x)+i)}-\frac {(d \cot (e+f x))^{n+3}}{4 d^3 f (a \cot (e+f x)+i a)^2} \]
[In]
[Out]
Rule 371
Rule 3557
Rule 3619
Rule 3640
Rule 3677
Rule 3754
Rubi steps \begin{align*} \text {integral}& = \frac {\int \frac {(d \cot (e+f x))^{2+n}}{(i a+a \cot (e+f x))^2} \, dx}{d^2} \\ & = -\frac {(d \cot (e+f x))^{3+n}}{4 d^3 f (i a+a \cot (e+f x))^2}+\frac {\int \frac {(d \cot (e+f x))^{2+n} (-i a d (1-n)-a d (1+n) \cot (e+f x))}{i a+a \cot (e+f x)} \, dx}{4 a^2 d^3} \\ & = -\frac {i n (d \cot (e+f x))^{3+n}}{4 a^2 d^3 f (i+\cot (e+f x))}-\frac {(d \cot (e+f x))^{3+n}}{4 d^3 f (i a+a \cot (e+f x))^2}+\frac {\int (d \cot (e+f x))^{2+n} \left (-2 a^2 d^2 (1+n)^2-2 i a^2 d^2 n (2+n) \cot (e+f x)\right ) \, dx}{8 a^4 d^4} \\ & = -\frac {i n (d \cot (e+f x))^{3+n}}{4 a^2 d^3 f (i+\cot (e+f x))}-\frac {(d \cot (e+f x))^{3+n}}{4 d^3 f (i a+a \cot (e+f x))^2}-\frac {(1+n)^2 \int (d \cot (e+f x))^{2+n} \, dx}{4 a^2 d^2}-\frac {(i n (2+n)) \int (d \cot (e+f x))^{3+n} \, dx}{4 a^2 d^3} \\ & = -\frac {i n (d \cot (e+f x))^{3+n}}{4 a^2 d^3 f (i+\cot (e+f x))}-\frac {(d \cot (e+f x))^{3+n}}{4 d^3 f (i a+a \cot (e+f x))^2}+\frac {(1+n)^2 \text {Subst}\left (\int \frac {x^{2+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{4 a^2 d f}+\frac {(i n (2+n)) \text {Subst}\left (\int \frac {x^{3+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{4 a^2 d^2 f} \\ & = -\frac {i n (d \cot (e+f x))^{3+n}}{4 a^2 d^3 f (i+\cot (e+f x))}-\frac {(d \cot (e+f x))^{3+n}}{4 d^3 f (i a+a \cot (e+f x))^2}+\frac {(1+n)^2 (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )}{4 a^2 d^3 f (3+n)}+\frac {i n (2+n) (d \cot (e+f x))^{4+n} \operatorname {Hypergeometric2F1}\left (1,\frac {4+n}{2},\frac {6+n}{2},-\cot ^2(e+f x)\right )}{4 a^2 d^4 f (4+n)} \\ \end{align*}
Time = 3.92 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.09 \[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=\frac {-2 a^3 d (3+n) (4+n) (d \cot (e+f x))^{3+n}+a (i+\cot (e+f x)) \left (-2 i a^2 d^4 n (3+n) (4+n) \cot ^3(e+f x) (d \cot (e+f x))^n+2 a^2 (i+\cot (e+f x)) \left (d (1+n)^2 (4+n) (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )+i n (2+n) (3+n) (d \cot (e+f x))^{4+n} \operatorname {Hypergeometric2F1}\left (1,\frac {4+n}{2},\frac {6+n}{2},-\cot ^2(e+f x)\right )\right )\right )}{8 a^5 d^4 f (3+n) (4+n) (i+\cot (e+f x))^2} \]
[In]
[Out]
\[\int \frac {\left (d \cot \left (f x +e \right )\right )^{n}}{\left (a +i a \tan \left (f x +e \right )\right )^{2}}d x\]
[In]
[Out]
\[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]
[In]
[Out]
\[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=- \frac {\int \frac {\left (d \cot {\left (e + f x \right )}\right )^{n}}{\tan ^{2}{\left (e + f x \right )} - 2 i \tan {\left (e + f x \right )} - 1}\, dx}{a^{2}} \]
[In]
[Out]
Exception generated. \[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=\text {Exception raised: RuntimeError} \]
[In]
[Out]
\[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]
[In]
[Out]
Timed out. \[ \int \frac {(d \cot (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx=\int \frac {{\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n}{{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^2} \,d x \]
[In]
[Out]